/*
 * Copyright 2000-2011 Worth Enterprises, Inc.  All Rights Reserved.
 */
package com.worthent.foundation.util.state;

/**
 * Specifies methods implemented by objects that perform actions during state
 * transitions.
 * 
 * @author Erik K. Worth
 * @version $Id: TransitionActor.java 2 2011-11-28 00:10:06Z erik.k.worth@gmail.com $
 */
public interface TransitionActor {
    /**
     * Returns the name of the StateActor for logging purposes.
     */
    String getName();

    /**
     * This method is called to take action on a state transition.
     * <p>
     * Concrete instances of this interface are created and inserted into the
     * table before the table is initialized.
     * 
     * @param fromState string ID of the state the table is transitioning from
     * @param toState string ID of the state the table is transitioning to
     * @param table the state table instance
     * @param event the event that triggered the transition
     * 
     * @exception StateExeException thrown when the onAction method fails (it
     *            prevents the state transition and subsequent action methods
     *            from being invoked)
     */
    void onAction(
        String fromState,
        String toState,
        StateTable table,
        StateEvent event) throws StateExeException;

}
